function loadResidence(value){
	$("#residenceId").combobox({
		url : "/residenceController/combobox",
		editable : false,
		value : value,
		onSelect : function(r){
			loadBuilding(r.value,'');
		}
	});
}
function loadBuilding(residenceId,value){
	$("#buildingId").combobox({
		url:"/buildingManager/combobox?residenceId="+residenceId,
		editable : false,
		value : value,
		onSelect:function(r){
			loadUnit(r.value,'');
		}
	});
}
function loadUnit(buildId,value){
	$("#unitId").combobox({
		url:"/buildingUnitManager/combobox?parentId="+buildId,
		editable : false,
		value : value,
		onSelect:function(r){
			loadDoor(r.value,'');
		}
	});
}
function loadDoor(unitId,value){
	$("#doorId").combobox({
		url:"/houseDoorplatManager/combobox?buildingUnitId="+unitId,
		value : value,
		editable : false
	});
}
function loadAccountType(){
	$("#typeId").combobox({
		url:"/accountType/combobox",
		editable : false
	});
}
function loadUploadChange(){
	$("#headImage").change(function(){
		var objUrl = getObjectURL(this.files[0]) ;
		console.log("objUrl = "+objUrl) ;
		if (objUrl) {
			$("#imgView").attr("src", objUrl) ;
		}
	}) ;
}

function loadStatus(){
	$("#status").combobox({
		url:"/account/accountStatus",
		editable : false
	});
}

function getObjectURL(file) {
	var url = null ; 
	if (window.createObjectURL!=undefined) { // basic
		url = window.createObjectURL(file) ;
	} else if (window.URL!=undefined) { // mozilla(firefox)
		url = window.URL.createObjectURL(file) ;
	} else if (window.webkitURL!=undefined) { // webkit or chrome
		url = window.webkitURL.createObjectURL(file) ;
	}
	return url ;
}